package com.zilue.security.service.impl;

import com.zilue.security.algorithm.DigestAlgorithm;
import com.zilue.security.algorithm.digest.MD5Digest;
import com.zilue.security.service.RsaPublicKeyAbstractService;

import java.util.Map;

/**
 * Created by zilue on 2017/1/17.
 */
    public class RsaPublicKeyService extends RsaPublicKeyAbstractService {
    //摘要算法
    private DigestAlgorithm digestAlgorithm;

    @Override
    public String getDigest(Map<String, String> paramterMap) {
        //默认为自带的MD5摘要算法
        if (digestAlgorithm == null)
            digestAlgorithm = new MD5Digest();

        return digestAlgorithm.getMapDigest(paramterMap);
    }

    public DigestAlgorithm getDigestAlgorithm() {
        return digestAlgorithm;
    }

    public void setDigestAlgorithm(DigestAlgorithm digestAlgorithm) {
        this.digestAlgorithm = digestAlgorithm;
    }
}
